package com.xnchat.pro.mapper;

import com.xnchat.pro.dto.Message;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface MessageRepository extends JpaRepository<Message, Integer> {
    Page<Message> findByNameIn(List<String> name, Pageable page);
    int countByNameIn(List<String> name);
    @Query(nativeQuery = true,value="select count(1) from `message`")
    int countAll();

    Page<Message> findAllByRoomid(String roomid,Pageable page);

    int countAllByRoomid(String roomid);
}
